﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArrayList
{
    public partial class frmArrayList : Form
    {
        public frmArrayList()
        {
            InitializeComponent();
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            System.Collections.ArrayList list = new System.Collections.ArrayList();

            list.Add(10);
            list.Add("test");
            list.Add(26.5);
            list.Add("March");
            list.Add(70);
            list.Add("cherry");

            list.Insert(1, "another");

            // to remove an element by value use
            list.Remove("March");
            // to remove an element by position use
            list.RemoveAt(0);

            foreach (Object obj in list)
            {
                MessageBox.Show(obj.ToString());
            }
        }
    }
}
